package com.tao.springcloud.controller;

import com.tao.springcloud.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName PaymentController
 * @Author HETAO
 * @Date 2020/5/10 16:18
 */
@RestController
@RequestMapping("hystrix")
@Slf4j
public class PaymentController {

    @Resource
    private PaymentService paymentService;

    @GetMapping("pyment/ok")
    public String paymentInfoOK(@RequestParam("id") Integer id) {
        String str = paymentService.paymentInfo_OK(id);
        log.info(str);
        return str;
    }

    @GetMapping("pyment/timeout/{id}")
    public String paymentInfoTimeOut(@PathVariable("id") Integer id) {
        String result = this.paymentService.paymentInfo_TimeOut(id);
        return result;
    }

    @GetMapping("pyment/circuitBreaker/{id}")
    public String circuitBreaker(@PathVariable("id") Integer id) {
        String result = this.paymentService.paymentCirCuitBreaker(id);
        return result;
    }
}
